﻿using System;
using System.Collections.Generic;

namespace EnumerationTest
{
    class Program
    {
        static void Main(string[] args)
        {
            //Console.WriteLine("Hello World!");
            //  Test1();
            //Test2();
            Test3();
        }

        static void Test1()
        {
            int[] data = { 1, 2, 3 };
            var rator = ((IEnumerable<int>)data);
            foreach (var value in rator)
            {
                Console.WriteLine(value);
            }
        }

        static void Test2()
        {
            MyCollection myCollection = new MyCollection();
            //foreach (var tempdata in myCollection)
            //{
            //    Console.WriteLine(tempdata);
            //}
            var myCollectionEnumerator = myCollection.GetEnumerator();
            while (myCollectionEnumerator.MoveNext())
            {
                var value = myCollectionEnumerator.Current;
                Console.WriteLine(value);
            }

        }

        static void Test3()
        {
            MyCollectionGeneric myCollection = new MyCollectionGeneric();

            var myCollectionEnumerator = myCollection.GetEnumerator();
            while (myCollectionEnumerator.MoveNext())
            {
                var value = myCollectionEnumerator.Current;
                Console.WriteLine(value);
            }
        }
    }
}
